from sqlalchemy import Column, Integer, String, ForeignKey,DateTime,Boolean
from .base import Base, TimestampMixin
from sqlalchemy.sql import func
from sqlalchemy import Column, String, Text, text


__all__ = ['UploadedImage']


class UploadedImage(Base,TimestampMixin):
    """上传图片信息表"""
    __tablename__ = 'cy_uploaded_images_record'

    id = Column(Integer, primary_key=True, autoincrement=True, comment='图片唯一ID')
    image_url = Column(String(255), nullable=True, comment='图片地址')
    image_type = Column(Integer, nullable=False, comment='图片类型：0=屏柜，1=装置，2=选开，3=硬压板，4=软压板，5=空开，6=备用')
    protection_room_id = Column(Integer, nullable=False, comment='所属保护室ID（根据图片类型，关联相应的表）')
    switchgear_cabinet_id = Column(Integer, nullable=False, comment='所属保护屏ID（根据图片类型，关联相应的表）')

    def __repr__(self):
        return f"<UploadedImage(id={self.id}, image_url='{self.image_url}', image_type={self.image_type}, related_id={self.related_id})>"

uploaded_images_record = UploadedImage.__table__
#
#
# from sqlalchemy import create_engine
#
# # 配置数据库连接（替换成你的实际数据库连接信息）
# engine = create_engine('mysql+pymysql://root:123456@localhost:3306/cygcadmin?charset=utf8mb4')
#
# # 使用 create_all() 创建所有未创建的表
# Base.metadata.create_all(engine)


